import { createRouter, createWebHashHistory } from 'vue-router';
import { routes, abnormalRoutes } from "/@/router/routes"
import { routeBefore, resovleRoute, routeAfter } from "/@/router/interceptor"

const router = createRouter({
    history: createWebHashHistory(),
    routes: [...routes, ...abnormalRoutes]
})

// 拦截器
// 路由前置守卫
router.beforeEach((to, from, next) => routeBefore(to, from, next))

// 解析守卫
// 在这里演示操作设置每页的名字
router.beforeResolve(async to => resovleRoute(to))

//路由后置守卫
router.afterEach((to, from) => routeAfter(to, from))


export default router